package top.continew.admin.controller.business;

import cn.shengchao.examstar.rpc.base.PageResult;
import cn.shengchao.examstar.rpc.member.api.IMemberRpc;
import cn.shengchao.examstar.rpc.member.req.MemberQueryPage;
import cn.shengchao.examstar.rpc.member.res.MemberList;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import top.continew.starter.web.model.R;

@Tag(name = "会员 API")
@RestController
@RequestMapping("/member")
public class MemberController {

    @DubboReference
    private IMemberRpc memberRpc;

    @GetMapping
    public PageResult<MemberList> getMemberList(MemberQueryPage memberQueryPage) {
        return memberRpc.getMemberList(memberQueryPage);
    }

    @PutMapping("{memberId}/status:{status}")
    public R updateMember(@PathVariable("memberId") Long memberId,@PathVariable("status") Integer status) {
        memberRpc.changeStatus(memberId,status);
        return R.ok();
    }

}
